<html>
<head><meta charset="utf-8"><title>s390x support · project-inline-asm · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/index.html">project-inline-asm</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/s390x.20support.html">s390x support</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="247892138"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/s390x%20support/near/247892138" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Timothy Maloney <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/s390x.20support.html#247892138">(Aug 02 2021 at 04:25)</a>:</h4>
<p>(deleted)</p>



<a name="248370618"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/s390x%20support/near/248370618" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Timothy Maloney <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/s390x.20support.html#248370618">(Aug 04 2021 at 16:05)</a>:</h4>
<p>Can anyone explain to me what a data register is and how to use it in LLVM? The only place it is mentioned is in the SystemZ constraint codes list. I'm adding register definitions for the s390x, and I can't find anything about how to reference an LLVM data register. Total newbie so forgive me in advance if this is a dumb or obvious question.</p>
<p><a href="https://llvm.org/docs/LangRef.html#supported-constraint-code-list">LLVM Constraint Code</a></p>



<a name="248371086"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/s390x%20support/near/248371086" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/s390x.20support.html#248371086">(Aug 04 2021 at 16:09)</a>:</h4>
<p>It is listed as LLVM specific, so I think it should not be supported by rustc as there is a <a href="https://github.com/antoyo/rustc_codegen_gcc">GCC backend</a> being worked on. In any case the <code>asm!()</code> RFC mentions that only the common subset between LLVM and GCC is allowed for the actual assembly.</p>



<a name="248371238"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/s390x%20support/near/248371238" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Timothy Maloney <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/s390x.20support.html#248371238">(Aug 04 2021 at 16:10)</a>:</h4>
<p>Awesome, thanks for the quick response!</p>



<a name="248374632"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/s390x%20support/near/248374632" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Timothy Maloney <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/s390x.20support.html#248374632">(Aug 04 2021 at 16:37)</a>:</h4>
<p>I also noticed that in:</p>
<p>rustc_target/asm/x86.rs </p>
<p>there is no “%” prefix for the register definitions, yet in:</p>
<p>rustc_target/asm/mips.rs </p>
<p>there is the “$” prefix for the register definitions. Should I assume this to mean that if the register prefix for an assembly language is “%” it’s not needed when defining the registers?</p>



<a name="248374848"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/s390x%20support/near/248374848" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/s390x.20support.html#248374848">(Aug 04 2021 at 16:38)</a>:</h4>
<p>On x86, <code>%</code> is part of the instruction syntax, not the register name. On MIPS, <code>$</code> is part of the register name.</p>



<a name="248374899"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/s390x%20support/near/248374899" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/s390x.20support.html#248374899">(Aug 04 2021 at 16:39)</a>:</h4>
<p>Additionally, the <code>%</code> is only for AT&amp;T syntax, not Intel syntax (which is the default).</p>



<a name="248376125"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/s390x%20support/near/248376125" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Timothy Maloney <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/s390x.20support.html#248376125">(Aug 04 2021 at 16:48)</a>:</h4>
<p>For clarification: so prefixes like “%” are only necessary if they are part of the actual  register name? As opposed to when the prefix is used to refer to an arbitrary register: e.g. %eax, or %ebx in x86.</p>



<a name="248376390"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/s390x%20support/near/248376390" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/s390x.20support.html#248376390">(Aug 04 2021 at 16:50)</a>:</h4>
<p>It's a bit of a fuzzy rule to be fair. As a general rule I'd follow what Clang does here.</p>



<a name="248376828"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/s390x%20support/near/248376828" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/s390x.20support.html#248376828">(Aug 04 2021 at 16:54)</a>:</h4>
<p>In clang/lib/Basic/Targets/SystemZ.cpp you can see that Clang uses <code>r0</code> to <code>r15</code> for integer registers, <code>f0</code> to <code>f15</code> for float registers and <code>v0</code> to <code>v31</code> for vector registers (where <code>v0-15</code> alias with <code>f0-15</code>).</p>



<a name="248377132"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/s390x%20support/near/248377132" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/s390x.20support.html#248377132">(Aug 04 2021 at 16:56)</a>:</h4>
<p>Also <a href="https://sourceware.org/binutils/docs-2.32/as/s390-Register.html">https://sourceware.org/binutils/docs-2.32/as/s390-Register.html</a></p>



<a name="248377170"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/s390x%20support/near/248377170" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Timothy Maloney <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/s390x.20support.html#248377170">(Aug 04 2021 at 16:57)</a>:</h4>
<p>Right but the current codegen for llvm on s390 assumes no vector registers</p>



<a name="248377240"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/s390x%20support/near/248377240" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/s390x.20support.html#248377240">(Aug 04 2021 at 16:57)</a>:</h4>
<p>Then only support <code>f0</code> to <code>f15</code> for now, vector register support can always be added later.</p>



<a name="248377246"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/s390x%20support/near/248377246" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Timothy Maloney <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/s390x.20support.html#248377246">(Aug 04 2021 at 16:57)</a>:</h4>
<p>Right? lol<br>
That helps a ton though thank you</p>



<a name="248662630"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/s390x%20support/near/248662630" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Timothy Maloney <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/s390x.20support.html#248662630">(Aug 06 2021 at 20:13)</a>:</h4>
<p>(deleted)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>